package cn.edu.cqvie.netty.zerocopy;

import java.io.DataInputStream;
import java.io.IOException;
import java.lang.reflect.Executable;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;

public class OldIOServer {

    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(8891);

        while (true) {
            Socket socket = serverSocket.accept();
            DataInputStream dataInputStream = new DataInputStream(socket.getInputStream());

            try{
                byte[] bytes = new byte[4096];

                while (true) {
                    //实际读取字节数量
                    int readcount = dataInputStream.read(bytes, 0 ,bytes.length);
                    if(-1 == readcount) {
                        break;
                    }

                }

            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }

    }
}
